Keycloak enforces unique usernames only among existing users, so a
name freed by a removed (here: deactivated) subject can be claimed by a
completely new user with a new UUID. Synchronizing that new user creates
a new subject (201 Created) despite the deactivated subject
still carrying the same name, because name-uniqueness only applies to
active subjects. The deactivated subject remains deactivated and
untouched.
SubjectSync: sync-alice - deactivated from 9035:
A Global Admin Can Deactivate a Removed Subject| name | value |
|---|---|
| newSubjectUuid | 238a0005-0000-0000-0000-000000000005 |
| subjectName | sync-alicia |
| subjectType | USER |
| deactivatedSubjectUuid | 238a0001-0000-0000-0000-000000000001 |
HTTP PUT "/api/rbac/subjects/238a0005-0000-0000-0000-000000000005" \
-H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
`# {` \
`# "sub" : "uuid<hsh-alex_superuser>"` \
`# }` \
-H 'Content-Type: application/json' \
--data-binary @- <<EOF
{
"name" : "sync-alicia",
"type" : "USER"
}
EOF
=> status: 201 CREATED 238a0005-0000-0000-0000-000000000005
HTTP GET "/api/rbac/subjects?name=sync-alicia" \
-H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
`# {` \
`# "sub" : "uuid<hsh-alex_superuser>"` \
`# }`
=> status: 200 OK
[ {
"uuid" : "238a0005-0000-0000-0000-000000000005",
"name" : "sync-alicia",
"type" : "USER"
} ]
HTTP GET "/api/rbac/subjects/238a0001-0000-0000-0000-000000000001" // SubjectSync: sync-alice \
-H "Authorization: Bearer $HSADMINNG_JWT_BEARER" \
`# {` \
`# "sub" : "uuid<hsh-alex_superuser>"` \
`# }`
=> status: 404 NOT_FOUND
generated on 2026-07-17 01:44:28 for branch